-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flexible declaration styling #9023
Conversation
2aa6d5f
to
7bb2473
Compare
4bfefc5
to
b16cb6c
Compare
I think it is now in a potentially mergeable state, ready to review. |
6fd299d
to
ed700ea
Compare
LGTM with nits! |
Thanks! It should be ready for a second round now. As a general point: what is your opinion on how to use |
Ideally, all writers should support all of the new nodes. But it increases the maintenance cost of the 3rd party builders. So I'm afraid that the warnings kill their deprecation because of the lack of maintenance. So -0 for emitting warnings. |
Good point, as noted in the review comment, I'll ensure that at least the writers bundled with Sphinx only needs the fallback for the |
Yes. I'll review this again tomorrow (or the next day). After that, let's merge this into 4.0.x branch. |
LGTM again. +1 for merging if fallback-transform supports the |
Thanks for the reviews! I'll rebase to 4.0.x and merge. |
Use the new node for cpp:expr
Add test objects so all builders gets exposed to the new nodes. Make the fallback node post-transform change desc_inline as well. Make the html4, latex, and text writers handle desc_inline.
08ad74a
to
cb21eb2
Compare
Feature or Bugfix
Purpose
Attempt to resolve a foundational chunk of #4289, building on #7145, #6990, #4390.
Examples of difference in HTML rendering
Current: https://jakobandersen.github.io/ex_sphinx_decl_styling/master/
With this: https://jakobandersen.github.io/ex_sphinx_decl_styling/with_9023/
For seeing the differences for the Python domain (change to monospace font) see e.g.,
extdev/appapi.html
.For the difference in styling with colouring in the C++ domain see e.g.,
usage/restructuredtext/domains.html#_CPPv46MyList
.Additional example of C++ differences
Current:
With this PR:
Details
addnodes.desc_sig_element
,and document them as being the leaf-nodes of signatures.
That is, they only contain text, no other nodes.
desc
,desc_signature
,desc_signature_line
, anddesc_content
as the nodes that form the top levels of object descriptions.
desc_
nodes as being high-level structuring nodes for signatures.desc_
nodes.nodes.Text
nodes.basic
theme to group by this node classification.addnodes
from the HTML and HTML5 writers.desc_inline
node for signature fragments in text.This is not for xrefs, but for roles like
cpp:expr
which contain arbitrary expressions or types.desc_signature
anddesc_inline
.Both get
sig
the domain name, and in additionsig-object
andsig-inline
respectively.While
desc
contains the domain, this also has arbitrary descriptions as decendants,so you can have a
py:function
with a description that contains acpp:expr
.If you want to style, e.g., keywords differently in the two languages, you can now select
.sig.py .k
and.sig.cpp .k
without them overlapping.desc_name
anddesc_addname
from using acode
tag to aspan
,and instead make all
.sig
use monospace as font-family consistently.Next steps, perhaps for future PRs
Only the basic theme has been changed. The rest should be checked.(done)desc_inline
is quick copy paste. The compiled PDF looks fine to me, but please check, e.g., with something like:cpp:expr:`a + b`
desc_
nodes perhaps should be looked at:desc_type
,desc_returns
,desc_parameterlist
,desc_parameter
,desc_optional
, anddesc_annotation
.I suggest doing this in a separate PR.
Convert the C domain to use the new nodes.(done)